<template>
	<div class="p_20 indexBanner">
		<el-dialog :visible.sync="isShow" title="编辑" :close-on-click-modal="false" @close="closeDialog">
			<!-- <el-divider></el-divider> -->
			<el-form :model="form" label-width="80px">
				
				<AutoUpload ref="AutoUpload" :upImg = "upImg"></AutoUpload>
				
				<AutoUpload ref="AutoUpload1" :upImg = "upImg1"></AutoUpload>
				
				<el-form-item label="标题">
					<el-input v-model="form.title" class="w_400"></el-input>
				</el-form-item>
				<el-form-item label="内容">
					<el-input v-model="form.content" class="w_400" type="textarea" :rows="6"></el-input>
				</el-form-item>
				
				
			</el-form>
			<span slot="footer" class="dialog-footer">
				<el-button @click="closeDialog">取 消</el-button>
				<el-button type="primary" @click="submit">确 定</el-button>
			</span>
		</el-dialog>
	</div>
</template>

<script>
	export default {
		data() {
			return {
				isShow: false,
				
				form: {
					img_url:'',
					img_url1:'',
					title:'',
					content:''
				},
				upImg:{
					label: '图片',
					imageUrl: '',
					name: 'file',
					width: '220',
					height: '219',
					file: ''
				},
				upImg1:{
					label: '图片2',
					imageUrl: '',
					name: 'file',
					width: '220',
					height: '219',
					file: ''
				},
				key:'',

				//图片上传
				imageUrl: '',
				imageUrl1: '',
				// dialogVisible: false,
				// disabled: false
			}
		},
		methods: {
			//提交
			submit(){
				
				this.form.img_url = this.upImg.imageUrl
				this.form.img_url1 = this.upImg1.imageUrl
				let params = {
					key:this.key,
					value:JSON.stringify(this.form),
					language:this.$store.getters.getLanguage
				};
				console.log(params);
				
				this.edit(params);
			},
			
			
			
			//编辑
			edit(params) {
				this.axiosPost('Development/development', params , res => {
					if(res.data.code === 0) {
						this.msgSuccess(res.data.message);
						this.$parent.getTableData();
						this.isShow = false;
					}else {
						this.msgError(res.data.message)
					}
				})
			},


			
			//关闭窗口 清空数据
			closeDialog(){
				this.form = {
					img_url:'',
					img_url1:'',
					title:'',
					content:''
				}
				
				this.upImg={
					label: '图片',
					imageUrl: '',
					name: 'file',
					width: '220',
					height: '219',
					file: ''
				},
				
				this.upImg1 = {
					label: '图片2',
					imageUrl: '',
					name: 'file',
					width: '220',
					height: '219',
					file: ''
				},
				this.imageUrl = ''
				this.imageUrl1 = ''
				this.isShow = false;
			}
		}
	}
</script>

<style scoped>

</style>
